﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BookingHotel_Proj.DBML;

namespace BookingHotel_Proj.DAL
{
    public class SupplierregisterDAO
    {
        SunBookingDataContext SBK = new SunBookingDataContext();
        public Supplier GetSupplier(int SupplierID)
        {
            return SBK.sp_SupplierSelect(SupplierID).SingleOrDefault();
        }

        public void AddSupplier(Supplier supplier)
        {
            Supplier addsupplier = new Supplier 
            {
                   UserName     = supplier.UserName,
                   Password     = supplier.Password,
	               TenKinhDoanh = supplier.TenKinhDoanh,
	               TenDaiDien   = supplier.TenDaiDien,
	                DiaChi = supplier.DiaChi,
	                Mobile = supplier.Mobile,
	                DienThoaiBan = supplier.DienThoaiBan,
	                SupplierLevel = supplier.SupplierLevel,
	                Active= supplier.Active,
	                CreateDate = supplier.CreateDate
            };
            SBK.Suppliers.InsertOnSubmit(addsupplier);
            SBK.SubmitChanges();
        }

    }
}